package br.com.edumobi.dados.modelos.enuns;

public enum UF {
    AC (1, "AC", "ACRE"),
    AL (2, "AL", "ALAGOAS"),
    AM (3, "AM", "AMAZONAS"),
    AP (4, "AP", "AMAPÁ"),
    BA (5, "BA", "BAHIA"),
    CE (6, "CE", "CEARÁ"),
    DF (7, "DF", "DISTRITO FEDERAL"),
    ES (8, "ES", "ESPIRITO SANTO"),
    GO (9, "GO", "GOIÁS"),
    MA (10, "MA", "MARANHÃO"),
    MG (11, "MG", "MINAS GERAIS"),
    MS (12, "MS", "MATO GROSSO DO SUL"),
    MT (13, "MT", "MATO GROSSO"),
    PA (14, "PA", "PARÁ"),
    PB (15, "PB", "PARAÍBA"),
    PE (16, "PE", "PERNAMBUCO"),
    PI (17, "PI", "PIAUÍ"),
    PR (18, "PR", "PARANÁ"),
    RJ (19, "RJ", "RIO DE JANEIRO"),
    RN (20, "RN", "RIO GRANDE DO NORTE"),
    RO (21, "RO", "RONDÔNIA"),
    RR (22, "RR", "RORAIMA"),
    RS (23, "RS", "RIO GRANDE DO SUL"),
    SC (24, "SC", "SANTA CATARINA"),
    SE (25, "SE", "SERGIPE"),
    SP (26, "SP", "SÃO PAULO"),
    TO (27, "TO", "TOCANTINS");

    public int id;
    public String sigla;
    public String nome;

    UF (int id, String sigla, String nome){
       this.id = id;
       this.sigla = sigla;
       this.nome = nome;
    }

    public static UF getEnum(int valueInt){
        UF[] ufs = UF.values();
        int lengthUfs = ufs.length;
        for (int index = 0; index < lengthUfs; index++) {
            if (ufs[index].id == valueInt) {
                return ufs[index];
            }
        }
        return null;
    }

    public static UF getEnum(String valueString) {
        UF[] ufs = UF.values();
        int lengthUfs = ufs.length;
        for (int index = 0; index < lengthUfs; index++) {
            if (ufs[index].sigla.equals(valueString)) {
                return ufs[index];
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return sigla + " " + nome;
    }
}
